package com.franz.noteapp.room.dao

import androidx.room.*
import com.franz.noteapp.bean.NoteBean
import kotlinx.coroutines.flow.Flow

@Dao
interface NoteDao {
    @Query("SELECT *FROM NoteTable")
    fun queryAll(): Flow<List<NoteBean>>

    @Query("SELECT *FROM NoteTable WHERE id = :id")
    suspend fun queryById(id:Int): NoteBean?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertNote(bean: NoteBean)

    @Delete
    suspend fun deleteNote(bean: NoteBean)
}